home *** CD-ROM | disk | FTP | other *** search
/ Financial Peace University Interactive Bonus / Financial Peace University Bonus Interactive CD-ROM.iso / pc / calculators / futureValue.swf / scripts / __Packages / mx / screens / Form.as next >
Encoding:
Text File  |  2006-02-07  |  3.1 KB  |  135 lines

  1. class mx.screens.Form extends mx.screens.Screen
  2. {
  3.    var _childForms;
  4.    static var symbolName = "Form";
  5.    static var symbolOwner = mx.screens.Form;
  6.    var className = "Form";
  7.    var _isForm = true;
  8.    var _indexInParentForm = 0;
  9.    var _sendRevealDuringRedraw = true;
  10.    function Form()
  11.    {
  12.       super();
  13.    }
  14.    function get visible()
  15.    {
  16.       return super.visible;
  17.    }
  18.    function set visible(x)
  19.    {
  20.       if(x == true && this.visible == false)
  21.       {
  22.          this._sendRevealDuringRedraw = false;
  23.       }
  24.       super.setVisible(x,false);
  25.    }
  26.    function get indexInParentForm()
  27.    {
  28.       return this._indexInParentForm;
  29.    }
  30.    function get numChildForms()
  31.    {
  32.       return this._childForms.length;
  33.    }
  34.    function get parentIsForm()
  35.    {
  36.       return this.parentForm != null && this.parentForm._isForm;
  37.    }
  38.    function get parentForm()
  39.    {
  40.       var _loc2_ = this._parent;
  41.       while(true)
  42.       {
  43.          if(_loc2_ == null)
  44.          {
  45.             return null;
  46.          }
  47.          if(_loc2_._isForm)
  48.          {
  49.             return mx.screens.Form(_loc2_);
  50.          }
  51.          if(_loc2_._isFormContainer)
  52.          {
  53.             _loc2_ = _loc2_._parent;
  54.          }
  55.          else if(!_loc2_._isForm)
  56.          {
  57.             return null;
  58.          }
  59.       }
  60.    }
  61.    function get rootForm()
  62.    {
  63.       var _loc2_ = this;
  64.       while(_loc2_.parentIsForm)
  65.       {
  66.          _loc2_ = _loc2_.parentForm;
  67.       }
  68.       return _loc2_;
  69.    }
  70.    static function get currentFocusedForm()
  71.    {
  72.       var curFocus;
  73.       curFocus = _root.focusManager.getFocus();
  74.       if(!curFocus || curFocus == undefined)
  75.       {
  76.          curFocus = eval(Selection.getFocus());
  77.       }
  78.       while(curFocus && !curFocus._isForm)
  79.       {
  80.          curFocus = curFocus._parent;
  81.       }
  82.       if(curFocus == undefined)
  83.       {
  84.          return null;
  85.       }
  86.       return mx.screens.Form(curFocus);
  87.    }
  88.    function getChildForm(childIndex)
  89.    {
  90.       return this._childForms[childIndex];
  91.    }
  92.    function drawFocus()
  93.    {
  94.    }
  95.    function init()
  96.    {
  97.       this._childForms = [];
  98.       super.init();
  99.       if(this.parentIsForm)
  100.       {
  101.          this._parent.registerChildForm(this);
  102.       }
  103.    }
  104.    function registerChildForm(form)
  105.    {
  106.       form._indexInParentForm = this._childForms.push(form) - 1;
  107.    }
  108.    function redraw(bAlways)
  109.    {
  110.       super.redraw(bAlways);
  111.       if(this._sendRevealDuringRedraw && this.visible == true)
  112.       {
  113.          this.dispatchEvent({type:"reveal",target:this});
  114.          this._sendRevealDuringRedraw = false;
  115.       }
  116.    }
  117.    function childLoaded(obj)
  118.    {
  119.       super.childLoaded(obj);
  120.       if(obj._containedScreen._isForm)
  121.       {
  122.          var _loc3_ = obj._containedForm;
  123.          var _loc4_ = mx.screens.Form(obj._parent);
  124.          obj._isFormContainer = true;
  125.          obj._containedForm = _loc3_;
  126.          _loc3_._indexInParentForm = _loc4_._childForms.push(_loc3_) - 1;
  127.       }
  128.    }
  129.    function destroyChildAt(childIndex)
  130.    {
  131.       this._childForms.splice(childIndex,1);
  132.       super.destroyChildAt(childIndex);
  133.    }
  134. }
  135.